Skip to content

fix(bash completions): allows workbearks [clap_complete/unstable-dynamic]#6283

Closed
feraxhp wants to merge 2 commits intoclap-rs:masterfrom
feraxtx:feat/bash-wordbreaks
Closed

fix(bash completions): allows workbearks [clap_complete/unstable-dynamic]#6283
feraxhp wants to merge 2 commits intoclap-rs:masterfrom
feraxtx:feat/bash-wordbreaks

Conversation

@feraxhp
Copy link
Copy Markdown

@feraxhp feraxhp commented Feb 25, 2026

This pr tries to solve all the related issues with the Bash default COMP_WORDBREAKS

A prior pr with a similar approach is #6264. but this is a more general approach.

Note

I may need help with a new test set, but it is very difficult because the behavior
is changed in bash rather than inside of the lib.

@feraxhp
Copy link
Copy Markdown
Author

feraxhp commented Feb 25, 2026

@epage sorry if i am being a headache, but i couldn't understand why is this test is failing, could you help me, please.

 thread 'bash::complete_dynamic_empty_option_value' (3174) panicked at clap_complete/tests/testsuite/bash.rs:465:5:

---- expected: tests/testsuite/bash.rs:463:20
++++ actual:   In-memory
   1      - exhaustive --empty=     % exhaustive --empty=∅
        1 + exhaustive --empty=∅

the actual value, is not the expected behavior? i am a little confused.

@feraxhp
Copy link
Copy Markdown
Author

feraxhp commented Feb 25, 2026

I also want to know if its better to have '=' as default or ':' or both...

@epage
Copy link
Copy Markdown
Member

epage commented Feb 25, 2026

Looks like there are still design aspects to work out, so discussing them at #6280 (to avoid splitting the conversation between the two competing PRs).

On PR structure:

  • We expect commits to reflect how they should be reviewed and merged and now how they are developed
  • Commits should be atomic
  • Preferably, tests are added in a commit prior to the change in behavior, with them passing, reproducing the undesired behavior. The fix would then update the tests to pass and the diff between them would represent how behavior changed

See also https://github.com/clap-rs/clap/blob/master/CONTRIBUTING.md#preparing-the-pr

sorry if i am being a headache, but i couldn't understand why is this test is failing, could you help me, please.

I'm unsure why CI and locally, these diverge. For now, I just make sure the output matches CI.

I may need help with a new test set, but it is very difficult because the behavior
is changed in bash rather than inside of the lib.

We have shell integration tests that run the completions inside of the shell. For the new completion system, we try to limit this to shell specific logic which fits here. We try to mirror the tests across the different shells so we can see where all stand, even if a fix only goes into one.

@feraxhp feraxhp closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants